package com.BlackHourse.P1.demo1;

import java.util.Random;
import java.util.Scanner;

public class RandomDemo {
    public static void main(String[] args) {
        //开启猜数字的情况
        Scanner scanner = new Scanner(System.in);
        Random r = new Random();
        int num = r.nextInt(100)+1;

        while (true){
            System.out.println("请输入一个1-100之间的整数进行数字猜");
            int guessnum = scanner.nextInt();
            if(guessnum>num){
                System.out.println("不好意思您猜的数字"+guessnum+"大了");
            }else if(guessnum<num){
                System.out.println("不好意思您猜的数字"+guessnum+"小了");
            }else{
                System.out.println("您猜的数字"+guessnum+"正好猜中了，太厉害了");
                break;
            }
        }
    }
}
